if (this.isDummy) {
this.animationInProgress = false;
this.visible = false;
- this.workspaces = null;
return;
}
this._lastActiveWorkspaceIndex = -1;
this._lastHoveredWindow = null;
this._needsFakePointerEvent = false;
-
- this.workspaces = null;
},
// The members we construct that are implemented in JS might
this._workspacesDisplay.show();
- this.workspaces = this._workspacesDisplay.workspacesView;
- global.overlay_group.add_actor(this.workspaces.actor);
-
if (!this._desktopFade.child)
this._desktopFade.child = this._getDesktopClone();
- if (!this.workspaces.getActiveWorkspace().hasMaximizedWindows()) {
+ if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows()) {
this._desktopFade.opacity = 255;
this._desktopFade.show();
Tweener.addTween(this._desktopFade,
this.animationInProgress = true;
this._hideInProgress = true;
- if (!this.workspaces.getActiveWorkspace().hasMaximizedWindows()) {
+ if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows()) {
this._desktopFade.opacity = 0;
this._desktopFade.show();
Tweener.addTween(this._desktopFade,
transition: 'easeOutQuad' });
}
- this.workspaces.hide();
+ this._workspacesDisplay.zoomFromOverview();
// Make other elements fade out.
Tweener.addTween(this._group,
global.window_group.show();
- this.workspaces.destroy();
- this.workspaces = null;
-
this._workspacesDisplay.hide();
this._desktopFade.hide();
const WindowClone = new Lang.Class({
Name: 'WindowClone',
- _init : function(realWindow) {
+ _init : function(realWindow, workspace) {
this.realWindow = realWindow;
this.metaWindow = realWindow.meta_window;
this.metaWindow._delegate = this;
+ this._workspace = workspace;
let [borderX, borderY] = this._getInvisibleBorderPadding();
this._windowClone = new Clutter.Clone({ source: realWindow.get_texture(),
this.emit('drag-begin');
},
- _getWorkspaceActor : function() {
- let index = this.metaWindow.get_workspace().index();
- return Main.overview.workspaces.getWorkspaceByIndex(index);
- },
-
handleDragOver : function(source, actor, x, y, time) {
- let workspace = this._getWorkspaceActor();
- return workspace.handleDragOver(source, actor, x, y, time);
+ return this._workspace.handleDragOver(source, actor, x, y, time);
},
acceptDrop : function(source, actor, x, y, time) {
- let workspace = this._getWorkspaceActor();
- workspace.acceptDrop(source, actor, x, y, time);
+ this._workspace.acceptDrop(source, actor, x, y, time);
},
_onDragCancelled : function (draggable, time) {
// Create a clone of a (non-desktop) window and add it to the window list
_addWindowClone : function(win) {
- let clone = new WindowClone(win);
+ let clone = new WindowClone(win, this);
let overlay = new WindowOverlay(clone, this._windowOverlaysGroup);
clone.connect('selected',
return this._workspaces[active];
},
- getWorkspaceByIndex: function(index) {
- return this._workspaces[index];
- },
-
hide: function() {
let activeWorkspaceIndex = global.screen.get_active_workspace_index();
let activeWorkspace = this._workspaces[activeWorkspaceIndex];
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
this.actor.connect('allocate', Lang.bind(this, this._allocate));
+ this.actor.connect('parent-set', Lang.bind(this, this._parentSet));
this.actor.set_clip_to_allocation(true);
let controls = new St.Bin({ style_class: 'workspace-controls',
this._thumbnailsBox = new WorkspaceThumbnail.ThumbnailsBox();
controls.add_actor(this._thumbnailsBox.actor);
- this.workspacesView = null;
+ this._workspacesView = null;
this._inDrag = false;
this._cancelledDrag = false;
this._windowDragBeginId = 0;
this._windowDragCancelledId = 0;
this._windowDragEndId = 0;
+ this._notifyOpacityId = 0;
},
show: function() {
this._workspaces[i] = new Workspace.Workspace(metaWorkspace, this._monitorIndex);
}
- if (this.workspacesView)
- this.workspacesView.destroy();
- this.workspacesView = new WorkspacesView(this._workspaces);
+ if (this._workspacesView)
+ this._workspacesView.destroy();
+ this._workspacesView = new WorkspacesView(this._workspaces);
this._updateWorkspacesGeometry();
+ global.overlay_group.add_actor(this._workspacesView.actor);
this._restackedNotifyId =
global.screen.connect('restacked',
this._onRestacked();
},
+ zoomFromOverview: function() {
+ this._workspacesView.hide();
+ },
+
hide: function() {
this._controls.hide();
this._thumbnailsBox.hide();
this._windowDragEndId = 0;
}
- this.workspacesView.destroy();
- this.workspacesView = null;
+ this._workspacesView.destroy();
+ this._workspacesView = null;
for (let w = 0; w < this._workspaces.length; w++) {
this._workspaces[w].disconnectAll();
this._workspaces[w].destroy();
}
},
+ activeWorkspaceHasMaximizedWindows: function() {
+ return this._workspacesView.getActiveWorkspace().hasMaximizedWindows();
+ },
+
// zoomFraction property allows us to tween the controls sliding in and out
set zoomFraction(fraction) {
this._zoomFraction = fraction;
this._updateWorkspacesGeometry();
},
+ _parentSet: function(actor, oldParent) {
+ if (oldParent && this._notifyOpacityId)
+ oldParent.disconnect(this._notifyOpacityId);
+ this._notifyOpacityId = 0;
+
+ Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this,
+ function() {
+ let newParent = this.actor.get_parent();
+ if (!newParent)
+ return;
+
+ // This is kinda hackish - we want the primary view to
+ // appear as parent of this.actor, though in reality it
+ // is added directly to overlay_group
+ this._notifyOpacityId = newParent.connect('notify::opacity',
+ Lang.bind(this, function() {
+ let opacity = this.actor.get_parent().opacity;
+ this._workspacesView.actor.opacity = opacity;
+ if (opacity == 0)
+ this._workspacesView.actor.hide();
+ else
+ this._workspacesView.actor.show();
+ }));
+ }));
+ },
+
_updateWorkspacesGeometry: function() {
- if (!this.workspacesView)
+ if (!this._workspacesView)
return;
let fullWidth = this.actor.allocation.x2 - this.actor.allocation.x1;
let clipX = rtl ? x + controlsVisible : x;
let clipY = y + (fullHeight - clipHeight) / 2;
- this.workspacesView.setClipRect(clipX, clipY, clipWidth, clipHeight);
+ this._workspacesView.setClipRect(clipX, clipY, clipWidth, clipHeight);
if (this._zoomOut) {
width -= controlsNatural;
let difference = fullHeight - height;
y += difference / 2;
- this.workspacesView.setGeometry(x, y, width, height, difference);
+ this._workspacesView.setGeometry(x, y, width, height, difference);
},
_onRestacked: function() {
stackIndices[stack[i].get_meta_window().get_stable_sequence()] = i;
}
- this.workspacesView.syncStacking(stackIndices);
+ this._workspacesView.syncStacking(stackIndices);
this._thumbnailsBox.syncStacking(stackIndices);
},
this._updateAlwaysZoom();
this._updateZoom();
- if (this.workspacesView == null)
+ if (this._workspacesView == null)
return;
let lostWorkspaces = [];
this._thumbnailsBox.removeThumbmails(removedIndex, removedNum);
}
- this.workspacesView.updateWorkspaces(oldNumWorkspaces,
- newNumWorkspaces);
+ this._workspacesView.updateWorkspaces(oldNumWorkspaces,
+ newNumWorkspaces);
},
_updateZoom : function() {
this._zoomOut = shouldZoom;
this._updateWorkspacesGeometry();
- if (!this.workspacesView)
+ if (!this._workspacesView)
return;
Tweener.addTween(this,
time: WORKSPACE_SWITCH_TIME,
transition: 'easeOutQuad' });
- this.workspacesView.updateWindowPositions();
+ this._workspacesView.updateWindowPositions();
}
},